layout (location = 0) out vec4 eceGlPosition;
layout (location = 1) out vec4 eceGlNormal;
layout (location = 2) out vec4 eceGlAlbedoSpec;
layout (location = 3) out vec4 eceGlGameData;

uniform ece_Material material1;
uniform ece_Material material2;
uniform ece_Material material3;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D texture3;
varying vec2 vTexCoord;
varying vec2 vTexAlpha;
varying vec3 vNormal;
varying vec3 vPosition;
varying float vDistance;
void main() {
	vec4 baseColor1 = texture2D(texture1, vTexCoord);
	vec4 baseColor2 = texture2D(texture2, vTexCoord);
	vec4 baseColor3 = texture2D(texture3, vTexCoord);
	float z = 1.0 - vTexAlpha.x - vTexAlpha.y;
	vec4 baseColor = baseColor1 * vTexAlpha.x + baseColor2 * vTexAlpha.y + baseColor3 * z;
	
	ece_Material material;
	material.enable = true;
	material.diffuse = material1.diffuse * vTexAlpha.x + material2.diffuse * vTexAlpha.y + material3.diffuse * z;
	material.specular = material1.specular * vTexAlpha.x + material2.specular * vTexAlpha.y + material3.specular * z;
	material.shininess = material1.shininess * vTexAlpha.x + material2.shininess * vTexAlpha.x + material3.shininess * z;
	
	eceGlPosition.rgb = vPosition;
	eceGlPosition.a = vDistance;
	eceGlNormal.rgb = vNormal;
	eceGlNormal.a = material.shininess;
	eceGlAlbedoSpec.rgb = baseColor.rgb * material.diffuse;
	eceGlAlbedoSpec.a = material.specular.r;
	//可以进行贴花
	eceGlGameData.r = 1.0;
}